<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/main.css">
<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/js/main.js"></script>
<script src="js/city2.js"></script>
<script type="text/javascript" src="js/citySelect2.js"></script>
<title>总部</title>
</head>
<body>
	<%@ include file="header.jsp"%>
	<%@ include file="left.jsp"%>
	<div id="index"
		style="position: absolute;left: 180px;top: 80px;bottom: 0;right: 0;">

		<style>
		.main_title>span{
		 float:left;
		 margin-left:20px;
		 cursor:pointer
		}
.main_div {
	min-width: 1000px;
	min-height: 60px
}

.force-overflow1-1 {
	border: none
}

.buttonPic>span {
	color: #FFFFFF;
	font-size: 36px
}

.pageChange {
	float: right;
	color: #337ab7;
}

.pageChange>span {
	cursor: pointer
}

.pageChange>span:hover {
	color: blue
}
</style>
		<section id="main">
			<div class="scrollbar1-1" id="style1-1">
				<div class="main_div">
					<div class="main_title">
						<span onclick="toComplain()" style="color:#ccc">超市投诉</span><span >团购投诉</span>
					</div>
					<form class="form-inline"
						style="margin-top: 30px;margin-left: 20px">
						<div class="form-group" id="city_4">
							<select class="form-control" id="prov4" data-code="510000"></select>
							<select class="form-control" id="city4" data-code="-1"></select>
							<select class="form-control" id="area4" data-code="-1"></select>
						</div>
						<script>
							var selectVal = new CitySelect({
								data : data,
								provId : "#prov4",
								cityId : '#city4',
								areaId : '#area4'
							});
						</script>
						<div class="form-group offset-col-xs-3">
							<label for="orderCode"> 商家名称:</label> <input type="text"
								class="form-control" id="superName" placeholder="">
						</div>
						<div class="form-group">
							<label for="ProductName">联系电话:</label> <input type="text"
								class="form-control" id="phone" placeholder="">
						</div>

						<button type="button" onclick="selectinfo()"
							class="btn btn-primary">立即查询</button>
					</form>
				</div>
				<div class="force-overflow1-1">
					<table class="table table-condensed table-bordered table-hover"
						id="showTable" style="text-align: center">
						<tr style="background-color: #59c7d2">
							<th style="text-align: center">序号</th>
							<th style="text-align: center">商家名称</th>
							<th style="text-align: center">联系人</th>
							<th style="text-align: center">联系电话</th>
							<th style="text-align: center">投诉数量</th>
							<th style="text-align: center">查看详情</th>
						</tr>
					</table>
					<div class="pageChange">
						<span onclick="prePage()">&nbsp;&nbsp;上一页&nbsp;&nbsp;</span> <span
							onclick="nextPage()">&nbsp;&nbsp;下一页&nbsp;&nbsp;</span> <em>
							&nbsp; 第&nbsp;<span id="pageNum">1</span>&nbsp;页&nbsp;&nbsp;
						</em> <em>/&nbsp;&nbsp;共&nbsp;<span id="totalpage"></span>&nbsp;页
						</em> <em>&nbsp;&nbsp;&nbsp;跳到第<input id="searchInput"
							style="width:46px" maxlength="4" type="text">页
						</em>
						<button class="btn btn-primary" onclick="searchPage()">搜索</button>
					</div>
					<input style="display:none" value="7" id="pageCount"
						name="pageCount" />
				</div>
			</div>
		</section>

	</div>
	<script>
		$(function() {
			selectinfo()
		})
	
		
	
		function selectinfo() {
			var pageNum = $("#pageNum").html();
	
			var pageCount = $("#pageCount").val();
			var superName = $("#superName").val();
			var phone = $("#phone").val();
			var area = $("#area4").find("option:selected").val();
			if (superName == "") {
				superName = null;
			}
			if (phone == "") {
				phone = null;
			}
			if (area == -1) {
				area = null
			}
			$.post(urls + "seckillAction/getOtherInfoPage",
				{
					phone : phone,
					name : superName,
					pageNum : pageNum,
					pageCount : pageCount,
					agentRegion : area
				},
				function(data) {
				console.log(data)
					if (data) {
						var totalpage = data.totalpage;
						var orderlist = data.list;
						var table = $("#showTable");
						$("tr").remove(".addtr");
						for (var i = 0; i < orderlist.length; i++) {
							var count = orderlist[i].complainNum;
							if (!count) {
								count = "-";
							}
							var append = "<tr onclick='turnToSuper(\"" + orderlist[i].id + "\")' class='addtr'><td>" + (i + 1) + "</td>" +
								"<td >" + orderlist[i].name + "</td>" +
								"<td>" + orderlist[i].principal + "</td>" +
								"<td>" + orderlist[i].phone + "</td>" +
								"<td>" + count + "</td>" +
								"<td><button class='btn btn-primary'>查看投诉订单</button></td></tr>";
							table.append(append);
						}
						$("#totalpage").html(totalpage);
					}
				}
				, "json"
			)
		}
		function turnToSuper(e) {
			location.href = "${pageContext.request.contextPath}/YMGback/head/complaintsDetal.jsp?superIDs=" + e;
		}
		function toComplain(){
		location.href = "${pageContext.request.contextPath}/YMGback/head/complaintsCount.jsp"
		}
	</script>
</body>
</html>
